﻿@model FYSJcrm.Core.Web.Areas.SystemManage.Models.NavManageModels.NavManageEditViewModel
@{
    ViewBag.Title = "修改栏目";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<style type="text/css">
    body {
        background: #fff !important;
    }
</style>
<div class="wap-container">
    <div class="panel">
        <div class="panel-body">
            <form class="form form-horizontal" id="form-category-edit">
                <input type="hidden" name="Id" value="@Model.Navigation.Id" />
                <div class="row clearfix">
                    <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>上级栏目：</label>
                    <div class="form-controls col-xs-8 col-sm-10">
                        <span class="select-box">
                            <select class="select" id="sel_Sub" name="parentId">
                                <option value="0">顶级分类</option>
                                @foreach (var nav in Model.ParentNav)
                                {
                                    if (Model.Navigation.ParentId == nav.Id)
                                    {
                                        <option value="@nav.Id" selected>&nbsp;&nbsp;├ @nav.Title</option>
                                    }
                                    else
                                    {
                                        <option value="@nav.Id">&nbsp;&nbsp;├ @nav.Title</option>
                                    }
                                }
                            </select>
                        </span>
                    </div>
                    <div class="col-3"></div>
                </div>
                <div class="row clearfix">
                    <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>分类名称：</label>
                    <div class="form-controls col-xs-8 col-sm-10">
                        <input type="text" class="input-text" value="@Model.Navigation.Title" placeholder="" id="title" name="title">
                    </div>
                    <div class="col-3"> </div>
                </div>
                <div class="row clearfix">
                    <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>调用别名：</label>
                    <div class="form-controls col-xs-8 col-sm-10">
                        <input type="text" class="input-text" value="@Model.Navigation.Name" placeholder="" id="name" name="name" readonly>
                    </div>
                    <div class="col-3"></div>
                </div>
                <div class="row clearfix">
                    <label class="form-label col-xs-4 col-sm-2">栏目图标：</label>
                    <div class="form-controls col-xs-8 col-sm-10 skin-minimal">
                        <div class="radio-box">
                            <input type="radio" id="radio-1" name="iconUrl" value="#xe613;" @(Model.Navigation.IconUrl.Contains("&#xe613;") ? "checked" : "")>
                            <label for="radio-1"><i class="Hui-iconfont">&#xe613;</i></label>
                        </div>
                        <div class="radio-box">
                            <input type="radio" id="radio-2" name="iconUrl" value="#xe620;" @(Model.Navigation.IconUrl.Contains("&#xe620;") ? "checked" : "")>
                            <label for="radio-2"><i class="Hui-iconfont">&#xe620;</i></label>
                        </div>
                        <div class="radio-box">
                            <input type="radio" id="radio-3" name="iconUrl" value="#xe622;" @(Model.Navigation.IconUrl.Contains("&#xe622;") ? "checked" : "")>
                            <label for="radio-3"><i class="Hui-iconfont">&#xe622;</i></label>
                        </div>
                        <div class="radio-box">
                            <input type="radio" id="radio-4" name="iconUrl" value="#xe60d;" @(Model.Navigation.IconUrl.Contains("&#xe60d;") ? "checked" : "")>
                            <label for="radio-4"><i class="Hui-iconfont">&#xe60d;</i></label>
                        </div>
                        <div class="radio-box">
                            <input type="radio" id="radio-5" name="iconUrl" value="#xe62d;" @(Model.Navigation.IconUrl.Contains("&#xe62d;") ? "checked" : "")>
                            <label for="radio-5"><i class="Hui-iconfont">&#xe62d;</i></label>
                        </div>
                        <div class="radio-box">
                            <input type="radio" id="radio-6" name="iconUrl" value="#xe620;" @(Model.Navigation.IconUrl.Contains("&#xe620;") ? "checked" : "")>
                            <label for="radio-6"><i class="Hui-iconfont">&#xe620;</i></label>
                        </div>
                        <div class="radio-box">
                            <input type="radio" id="radio-7" name="iconUrl" value="#xe61a;" @(Model.Navigation.IconUrl.Contains("&#xe61a;") ? "checked" : "")>
                            <label for="radio-7"><i class="Hui-iconfont">&#xe61a;</i></label>
                        </div>
                        <div class="radio-box">
                            <input type="radio" id="radio-8" name="iconUrl" value="#xe62e;" @(Model.Navigation.IconUrl.Contains("&#xe62e;") ? "checked" : "")>
                            <label for="radio-8"><i class="Hui-iconfont">&#xe62e;</i></label>
                        </div>
                        <div class="radio-box">
                            <input type="radio" id="radio-9" name="iconUrl" value="#xe6e0;" @(Model.Navigation.IconUrl.Contains("&#xe6e0;") ? "checked" : "")>
                            <label for="radio-9"><i class="Hui-iconfont">&#xe6e0;</i></label>
                        </div>
                        <div class="radio-box">
                            <input type="radio" id="radio-10" name="iconUrl" value="#xe72d;" @(Model.Navigation.IconUrl.Contains("&#xe72d;") ? "checked" : "")>
                            <label for="radio-10"><i class="Hui-iconfont">&#xe72d;</i></label>
                        </div>
                        <div class="radio-box">
                            <input type="radio" id="radio-11" name="iconUrl" value="#xe63c;" @(Model.Navigation.IconUrl.Contains("&#xe63c;") ? "checked" : "")>
                            <label for="radio-11"><i class="Hui-iconfont">&#xe63c;</i></label>
                        </div>
                    </div>
                    <div class="col-3"> </div>
                </div>
                <div class="row clearfix">
                    <label class="form-label col-xs-4 col-sm-2">栏目链接：</label>
                    <div class="form-controls col-xs-8 col-sm-10">
                        <input type="text" class="input-text" value="@Model.Navigation.LinkUrl" placeholder="" id="linkUrl" name="linkUrl">
                    </div>
                    <div class="col-3"> </div>
                </div>
                <div class="row clearfix">
                    <label class="form-label col-xs-4 col-sm-2">操作类型：</label>
                    <div class="form-controls col-xs-8 col-sm-10 skin-minimal">
                        <div class="check-box">
                            <input type="checkbox" id="checkbox-1" name="actionTypes" value="Show" @(Model.Navigation.ActionType.Contains("Show") ? "checked" : "")>
                            <label for="checkbox-1">显示</label>
                        </div>
                        <div class="check-box">
                            <input type="checkbox" id="checkbox-2" name="actionTypes" value="View" @(Model.Navigation.ActionType.Contains("View") ? "checked" : "")>
                            <label for="checkbox-2">查看</label>
                        </div>
                        <div class="check-box">
                            <input type="checkbox" id="checkbox-3" name="actionTypes" value="Add" @(Model.Navigation.ActionType.Contains("Add") ? "checked" : "")>
                            <label for="checkbox-3">添加</label>
                        </div>
                        <div class="check-box">
                            <input type="checkbox" id="checkbox-4" name="actionTypes" value="Edit" @(Model.Navigation.ActionType.Contains("Edit") ? "checked" : "")>
                            <label for="checkbox-4">修改</label>
                        </div>
                        <div class="check-box">
                            <input type="checkbox" id="checkbox-5" name="actionTypes" value="Delete" @(Model.Navigation.ActionType.Contains("Delete") ? "checked" : "")>
                            <label for="checkbox-5">删除</label>
                        </div>
                    </div>
                    <div class="col-3"> </div>
                </div>
                <div class="row clearfix">
                    <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>排序数字：</label>
                    <div class="form-controls col-xs-8 col-sm-10">
                        <input type="text" class="input-text" value="@Model.Navigation.SortId" placeholder="" id="sortId" name="sortId">
                    </div>
                    <div class="col-3"> </div>
                </div>
                <div class="row clearfix">
                    <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>是否启用：</label>
                    <div class="form-controls col-xs-8 col-sm-10 skin-minimal">
                        <div class="check-box">
                            <input type="checkbox" id="checkbox-pinglun" name="isLock" value="@Model.Navigation.IsLock" @(Model.Navigation.IsLock == 0 ? "checked" : "")>
                            <label for="checkbox-pinglun">&nbsp;</label>
                        </div>
                    </div>
                    <div class="col-3"> </div>
                </div>

                <div class="row clearfix">
                    <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                        <input class="btn btn-primary radius" type="button" id="btnSave" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

@section FooterScript
{
    <script type="text/javascript" src="~/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
    <script type="text/javascript" src="~/lib/jquery.validation/1.14.0/validate-methods.js"></script>
    <script type="text/javascript" src="~/lib/jquery.validation/1.14.0/messages_zh.js"></script>
    <script type="text/javascript" src="~/static/business/js/main.js"></script>
    <script type="text/javascript">
        $(function () {
            $('.skin-minimal input').iCheck({
                checkboxClass: 'icheckbox-blue',
                radioClass: 'iradio-blue',
                increaseArea: '20%'
            });

            $("#form-category-edit").validate({
                rules: {
                    parentId: {
                        required: true,
                    },
                    title: {
                        required: true,
                    },
                    name: {
                        required: true
                    },
                    sortId: {
                        required: true,
                        digits: true
                    }
                }
            })

            $("#btnSave").click(function () {
                let flag = $("#form-category-edit").valid();
                if (flag) {
                    const URL = "/SystemManage/NavManage/Edit";
                    let formData = $("#form-category-edit").serializeArray();

                    savaData(URL, formData);
                }
            })
        });
    </script>
}
